﻿
import IComponent from "../IComponent"

/// transform组件
/// 包含位置信息，旋转
export default class TransformComponent extends IComponent
{
    position:cc.Vec2;
    rotateDegree: number;
    public constructor(pos:cc.Vec2)
    {
        super();
        this.type = "TransformComponent";
        this.position = cc.v2(pos);
    }
    ToString():string
    {
        return "[TransformComponent Id:{"+ this.entityId +"} Pos:"+ this.position.toString() +" Rot_Degree:{"+ this.rotateDegree +"}]";
    }

    GetPosition():cc.Vec2 { return cc.v2(this.position); }

    Clone():IComponent 
    {
        let com = new TransformComponent(cc.v2(this.position));
        this._clone(com);
        com.position = cc.v2(this.position);
        com.rotateDegree = this.rotateDegree;
        return com;
    }
    GetCommand()
    {
        return "transform";
    }
}

